import requests
import json

# 话单推送至BOSS
def callTicket_push_boss(request):
    try:
        url = "http://172.16.235.8:8281/call_list_receive/"
        # url = "http://39.102.37.193:2035/call_list_receive/"
        headers = {
            "Content-Type": "application/json;charset=utf-8",
            "Accept": "application/json"
        }
        data = request.data
        requests.post(url=url, headers=headers, data=json.dumps(data))
        return
    except Exception as e:
        print(e)
        return

# 话单推送至CRM
def callTicket_push_crm(request):
    try:
        url = "http://39.102.47.215:2023/v1.0/count_call/"
        headers = {
            "Content-Type": "application/json;charset=utf-8",
            "Accept": "application/json"
        }
        data = request.data
        requests.post(url=url, headers=headers, data=json.dumps(data))
        return
    except Exception as e:
        print(e)
        return